#!/usr/bin/env python
# encoding: utf-8
"""
@author: youfeng
@email: youfeng243@163.com
@license: Apache Licence
@file: shixin_company_list.py
@time: 2018/2/4 20:46
"""

import sys

sys.path.append('../..')
from common.mongo import MongDb
from logger import Logger

COMPANY_MONGO_DB = {
    'host': '172.16.215.2',
    'port': 40042,
    'db': 'company_data',
    'username': 'work',
    'password': 'haizhi'
}

# 日志模块
log = Logger('print_ningbo_shixin_company_list.log').get_logger()

source_db = MongDb(COMPANY_MONGO_DB['host'], COMPANY_MONGO_DB['port'], COMPANY_MONGO_DB['db'],
                   COMPANY_MONGO_DB['username'],
                   COMPANY_MONGO_DB['password'], log=log)


def main():
    target_table = 'ningbo_shixin_company_list'

    for item in source_db.traverse_batch_field(target_table, {}, ['_id']):
        _id = item.get('_id')
        print _id


if __name__ == '__main__':
    main()
